home *** CD-ROM | disk | FTP | other *** search
/ Aminet 6 / Aminet 6 - June 1995.iso / Aminet / dev / c / llist1_1.lha / linked_list / linklist.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-20  |  2.4 KB  |  84 lines

  1.  
  2. /*=========================================================
  3.   == PROGRAM NAME : linklist.h                           ==
  4.   == --------------------------------------------------- ==
  5.   == DESCRIPTION : header file for all the functions in  ==
  6.   ==      the linked list library version 1.1            ==
  7.   =========================================================
  8. */
  9.  
  10. #include <exec/memory.h>
  11. #include <proto/exec.h>
  12. #include <stdlib.h>
  13.  
  14. /*
  15.  * here are some structures that can be used
  16.  * the void * is for the user to define and 
  17.  * control.  remember that if it is used a 
  18.  * typedef will probably have to be used.
  19.  * Also typedefing of user defined link structures
  20.  * may be required to use some of these functions
  21.  * without the compiler crying.
  22.  *
  23.  * NOTE : these structures don't have to be used but
  24.  * the pointers to the links have to be included in any
  25.  * user defined struct or none of these functions will work.
  26.  */
  27.  
  28. typedef struct _single {
  29.   struct _single  *next;
  30.   void             *data;
  31. } Single;
  32.  
  33. typedef struct _double {
  34.   struct _double  *next;
  35.   struct _double  *prev;
  36.   void            *data;
  37. } Double;
  38.  
  39. typedef struct _circle {
  40.   struct _circle  *next;
  41.   void              *data;
  42. } Circle;
  43.  
  44. /*
  45.  * standard functions for all the linked lists
  46.  */
  47. void *stdGetNewLink (int  /* size of the link */);  
  48.  
  49. /*
  50.  * functions for single linked lists
  51.  */
  52. Single *singleGetNewLink (void);
  53. Single *singleAttachBegin (Single *, Single *);
  54. Single *singleAttachEnd (Single *, Single *);
  55. Single *singleInsertLink (Single *, Single *);
  56. Single *singleDeleteLink (Single *, Single *);
  57. Single *singleSearch (void *, Single *);
  58. Single *singleFindEnd (Single *);
  59. void    singleDestroyList (Single *);
  60.  
  61. /*
  62.  * functions for double linked lists
  63.  */
  64. Double *doubleGetNewLink (void);
  65. Double *doubleAttachBegin (Double *, Double *);
  66. Double *doubleAttachEnd (Double *, Double *);
  67. Double *doubleInsertLink (Double *, Double *);
  68. Double *doubleDeleteLink (Double *, Double *);
  69. Double *doubleFindBegin (Double *);
  70. Double *doubleFindEnd (Double *);
  71. Double *doubleSearch (void *, Double *);
  72. void    doubleDestroyList (Double *);
  73.  
  74. /*
  75.  * functions for circular linked lists
  76.  */
  77. Circle *circleGetNewLink (void);
  78. Circle *circleStartList (Circle *);
  79. Circle *circleAttachEnd (Circle *, Circle *);
  80. Circle *circleInsertLink (Circle *, Circle *);
  81. Circle *circleDeleteLink (Circle *, Circle *);
  82. Circle *circleSearch (void *, Circle *);
  83. void    circleDestroyList (Circle *);
  84.